package cn.com.io.day20151214.control;

import cn.com.io.day20151214.pojo.Cup;

import java.io.*;

/**
 * 自定义序列化(一)
 */
public class TransientTest {
    public static void main(String[] args){
        ObjectOutputStream oos = null;
        ObjectInputStream ois = null;
        try {
            oos = new ObjectOutputStream(new FileOutputStream("transient.txt"));
            Cup cup = new Cup("HAERS","哈尔斯",65,"400ml");
            oos.writeObject(cup);

            ois = new ObjectInputStream(new FileInputStream("transient.txt"));
            Cup cupGet = (Cup)ois.readObject();
            System.out.println(cupGet.toString());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
